* Spatial Mismatch estimation, by Mark Kutzbach
set more off
set linesize 140

* used to run partial correlations
do pcorrmat.do

clear
set mem 1g

set matsize 2000

* paths
include "path.do"
display "Analysis for Vintage name: ${vint}"

* set version number and run name
local vnum="58"
local vers="run_app_e75"

* log starts here
log using mismatch_`vnum'_`vers'.smcl, replace
********************** Load Data ********************

* load csv produced from sas processing
cd "$progdir/$vint"
insheet using "$datadir/$vint/lostjob_analysis.csv", comma

* retain only those who were actually displaced
keep if displaced_ever_nosp_25==1

********************** Prepare Data ********************

include mismatch_`vnum'_setup.do
********************** Programs for Estimation ********************

include mismatch_`vnum'_programs.do
********************** Estimation ********************

* explanatory variables
local control_sex="female"
local control_grp="grp_black grp_hisp grp_other"
local control_age="age_20_24 age_35_44 age_45_54 age_55_64"
local control_earn="earntotallhuln earntotallln earndomln earndomsepln"
local control_job="tenuredom jobcount_hist sep_time_0020 sep_time_40up"
local control_sec="sec_sep_retl sec_sep_prof sec_sep_educ sec_sep_heal"
local control_hood="poverty_rate owner_rate pop_sq_mile build_age_med"
local control_year="sep_2001 sep_2002 sep_2003 sep_2004 sep_2005"
local control_seas="sep_seas_2 sep_seas_3 sep_seas_4"
local control_met="inind midet ohcol ohcle mnmin papit nybuf wimil"

* controls
local contstand="`control_sex' `control_grp' `control_age' `control_earn' `control_job' `control_hood'"

* search for jobs
local dep="earndom"
display "`dep'"
local suf="75"
display "`suf'"
local prox="feas"
display "`prox'"
local lim="10"
display "`lim'"

include mismatch_`vnum'_appendix.do

***************************************************************
* end of results
log close

* translate results
translate mismatch_`vnum'_`vers'.smcl mismatch_`vnum'_`vers'.txt, replace

